﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BEGDC.CC.BL.Common;
using BEGDC.Utility.Castle;

namespace ASB.CC.Web.SystemManagement
{
    public partial class LevelApprover : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BEGDC.CC.BL.Common.IUtility utility = AppContainer.Instance[ServiceConst.UtilityService] as BEGDC.CC.BL.Common.IUtility;
            
            if (!this.IsPostBack)
            {
                this.tbLv1Amount.Enabled = false;
                this.tbLv2Amount.Text = utility.GetLvAmount(2);
                this.tbLv1Amount.Text = this.tbLv2Amount.Text;
                this.tbLv3Amount.Text = utility.GetLvAmount(3);
                this.tbLv4Amount.Text = utility.GetLvAmount(4);
            }
        }

        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            this.btnSave.Click += new EventHandler(btnSave_Click);
            base.OnInit(e);
        }

        void btnSave_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            BEGDC.CC.BL.Common.IUtility utility = AppContainer.Instance[ServiceConst.UtilityService] as BEGDC.CC.BL.Common.IUtility;
            utility.SaveLvAmount(this.tbLv2Amount.Text, this.tbLv3Amount.Text, this.tbLv4Amount.Text);
            this.tbLv1Amount.Text = this.tbLv2Amount.Text;
        }
    }
}
